﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>
<link rel="stylesheet" type="text/css" href="${csspath}/style/video.css">
<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->
<script type="text/javascript" src="${jspath}/js/jquery-1.7.0.min.js"></script>
<script type="text/javascript" src="${jspath}/js/video.js"></script>
<script type="text/javascript" src="${jspath}/js/base.js"></script>
<script type="text/javascript" src="${jspath}/player/ck/ckplayer.js"></script>
<script type="text/javascript"  >
	
	function nextctg(url){
		
	};
	
</script>

<title>筑学堂家园个人空间</title>
</head>
<body style="align:center; padding:0;margin:0;clear:both; background-color:#FFF;">
<div class="video_bodyl"  controls oncontextmenu="return false;" >
	<div class="video_bodyltop"> 
	
	<c:choose>  
	   <c:when test="${course.ispublic}">
			<a href="/student/curriculum/pinitCourseCtg/${course.courseId}" style="color:#EFEFEF;"> 
	   </c:when>  
	   <c:otherwise>
	   		<a href="/student/curriculum/initCourseCtg/${course.courseId}" style="color:#EFEFEF;">
	   </c:otherwise>  
	</c:choose>
							
		
				<div class="video_bodyltop00"> </div>
				<div class="video_bodyltop01"> 返回课程页 </div>
			</a>
		<div class="video_bodyltop02"> ${course.courseName} </div>
	</div>
 
	<div class="video_bodylbot">
		<div id="showVideo" class="video_bodylbot00">
			 <!-- 放视频资源 -->
		</div>
	</div>
</div>
<div class="video_bodyr">
	<div class="video_bodyrtop">
		<div class="video_bodyrtop01"> ${course.courseName} </div>
		<div class="video_bodyrtop02"> 讲师： <a href="#" style="color:#DFDFDF;"> ${course.courseTeachernm}</a> </div>
	</div>
	<div class="video_bodyrbdoy">
		<div class="video_bodyrbdoytop"> <a href="#" onMouseOver="video(1,4)" onMouseDown="video01(1,4)">
			<div id="videob01" class="video_bodyrbdoytop01"  style="background-color:#23AB7B;color:#F1F1F1"> 目录 </div>
			</a> <a href="#" onMouseOver="video(2,4)" onMouseDown="video01(2,4)" >
			<div id="videob02" class="video_bodyrbdoytop01"> 资料 </div>
			</a> <a href="#" onMouseOver="video(3,4)" onMouseDown="video01(3,4)" >
			<div id="videob03" class="video_bodyrbdoytop01"> 笔记 </div>
			</a> <a href="#" onMouseOver="video(4,4)" onMouseDown="video01(4,4)" >
			<div id="videob04" class="video_bodyrbdoytop01"> 答疑 </div>
			</a> </div>
		<div id="content01" class="video_bodyrcontent" style="display:block"> 
			<iframe width="100%" height="580px"style="display:block" frameborder=0 scrolling="no" src="/student/curriculum/videoList/${course.courseId}/${currCtgId}/0/100?ispublic=${course.ispublic}"></iframe>
		</div>
		<div id="content02" class="video_bodyrcontent">
			<iframe width="100%" height="580px"style="display:block" frameborder=0 scrolling="yes" src="/student/curriculum/videoRes/${course.courseId}/0/100"></iframe>
		</div>
		<div id="content03" class="video_bodyrcontent">
			<iframe width="100%" height="580px"style="display:block" frameborder=0 scrolling="no" src="/student/notes/shortlist/${course.courseId}/1/100"></iframe>
		</div>
		<div id="content04" class="video_bodyrcontent">
			<iframe width="100%" height="580px"style="display:block" frameborder=0 scrolling="no" src="/student/question/ofquestall/${course.courseId}/0/100"></iframe>
		</div>
	</div>
</div>


<c:if test="${canStudy == true}">
		<script type="text/javascript">
		
		//检测是否支持HTML5
		function checkVideo() {
		    if (!!document.createElement('video').canPlayType) {
		        var vidTest = document.createElement("video");
		        oggTest = vidTest.canPlayType('video/ogg; codecs="theora, vorbis"');
		        if (!oggTest) {
		            h264Test = vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
		            if (!h264Test) {
		                return false;
		            }
		            else {
		                if (h264Test == "probably") {
		                    return true;
		                }
		                else {
		                    return false;
		                }
		            }
		        }
		        else {
		            if (oggTest == "probably") {
		                return true;
		            }
		            else {
		               return false;
		            }
		        }
		    }
		    else {
		        return false;
		    }
		}




			if(false==checkVideo()){
				alert("当前浏览器版本过低还请升级最新版本..");
			}else{
				$('#showVideo').bind('contextmenu',function() { return false; }); 
			}
		
		
			var timertask = null;
			var markTime = 0;
			var markTime2 = 0;
			 
			var url =   ('/student/curriculum/p/${course.courseId}/${currCtgId}/${safeKey}'+"/" );
			var ispublic = ${course.ispublic};
			var setFunction = function(){
				 if(ispublic){return;}
				 if(CKobject.getObjectById('ckplayer_object_id').getType()){
					 var Media = document.getElementById("ckplayer_object_id"); 
					 markTime = parseInt( Media .currentTime ); 
				 }else{
					 
				 }
				 if(markTime !=markTime2){
						markTime2 = markTime;
						AjaxToolNoEncode("get",url + markTime ,{ },"json",function(){});
				 }
			};
			
			function pausedHandler(b){
			    if(timertask && timertask !=null ){
			     	window.clearInterval(timertask);
			    }
			    if(!b){
			    	
			    }
			};
			
			function loadedHandler(){
			    if(CKobject.getObjectById('ckplayer_object_id').getType()){
			    	 CKobject.getObjectById('ckplayer_object_id').addListener('time',timeHandler);
			    	 //('播放器已加载，调用的是HTML5播放模块');
			    	 timertask=window.setInterval(setFunction,10000);
			      }else{
			    	  CKobject.getObjectById('ckplayer_object_id').addListener('time','timeHandler');
			    	  //('播放器已加载，调用的是Flash播放模块');
			      }
			}
			/***进度float 7.219  **/
			function timeHandler(t){
			    if(t>-1){
			    	try{
			    		//flash记录时间
				        markTime = parseInt(t);
			    	}catch(e){
			    		
			    	}
			    };
			};
			
			
		    var flashvars={
		        f:'${video.videoResourceUrl}',/*flash 需要先全部下载后才播放， html 边下载播放 */
		        c:0,
		        s:0,//s=1 /**flash error **/
		        p:0,
		        h:4,
		        wh:"4:3",
		     //   i:'http://resource.zhuclass.com/drmimg/0e98ac0e6d0dc889f883360b56f0759e?w=240&h=180',/**flash error **/
		     //   a:"http://localhost/video",/**flash error **/
		        loaded:'loadedHandler'
		    };
		    var video=['${video.videoResourceUrl}->video/mp4'];/***is use html5  if flase use this parameter is nothing ***/
		    CKobject.embed('${jspath}/player/ck/ckplayer.swf','showVideo','ckplayer_object_id','800px','600px',true,flashvars,video);
		</script>
</c:if>

 <!-- 判断是否 不能学习当前课件  -->
<c:if test="${ canStudy!=true}">
	<script type="text/javascript">
		alert("之前的课件还有没学完的..");
	</script>
</c:if>

<form id="videoFrom"></form>
</body>
</html>